<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="templates/template_login.xhtml">
        <h:head>
            <title>Seja bem-vindo ao ThreeDs!</title>
        </h:head>
        <ui:define name="content">
            <h:body>
                <h:form>
                    <!-- Painel -->
                    <p:panel id="panel" header="#{msgs.projetista}">  
                        <h:panelGrid columns="3">  

                            <h:outputLabel for="nome" value="#{msgs.nome}: *" />  
                            <p:inputText id="nome" label="Nome" required="true" requiredMessage="#{msgs.campoobrigatorio}"
                                         value="#{projetistaBean.projetista.nome}" size="50" maxlength="100" />
                            <p:message for="nome" />  

                            <h:outputLabel for="e-mail" value="E-mail*"/>
                            <p:inputText id="e-mail" label="e-mail" required="true"  requiredMessage="#{msgs.campoobrigatorio}"
                                         value="#{projetistaBean.projetista.EMail}" size="50" maxlength="100"/>
                            <p:message for="e-mail" />  

                            <h:outputLabel for="senha" value="#{msgs.senha}: *"/> 
                            <p:password value="#{projetistaBean.projetista.senha}" size="25" maxlength="20" feedback="false" id="senha" 
                                        label="senha" required="true"  requiredMessage="#{msgs.campoobrigatorio}"/>
                            <p:message for="senha" />  
                        </h:panelGrid>  
                    </p:panel>              
                    

                    <!-- Botões -->



                    <br>
                    <p:commandButton id="salvar" value="#{msgs.salvar}" actionListener="#{projetistaBean.salvar()}" update="panel,resultado" 
                                     image="ui-icon ui-icon-disk" title="Salvar" process="@this,panel"/>

                    <p:commandButton id="excluir" value="#{msgs.excluir}" actionListener="#{projetistaBean.excluir()}" update="panel,resultado" 
                                     image="ui-icon ui-icon-trash" title="Excluir" process="@this,panel,resultado">
                        <p:confirmDialog message="Deseja excluir este registro?" />
                    </p:commandButton>
                    </br>

                    <br></br>
                    <!-- Tabela -->
                    <p:dataTable id="resultado" var="projetista" value="#{projetistaBean.projetistas}" 
                                 selection="#{projetistaBean.projetista}" selectionMode="single" 
                                 update="panel">

                        <f:facet name="header">
                            #{msgs.resultados}
                        </f:facet>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{msgs.nome}"/>
                            </f:facet>
                            <h:outputText value="#{projetista.nome}"/>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="E-mail"/>
                            </f:facet>
                            <h:outputText value="#{projetista.EMail}"/>
                        </p:column>

                    </p:dataTable>
                      </h:form>
                <h:form>
                    <br>
                    <p:commandButton value="#{msgs.voltar}" image="imagens/new_project.png" action="login.xhtm" ajax="false"/>
                    <f:param name="productId" value="20"/>
                    </br>
                </h:form>

            </h:body>
        </ui:define>

    </ui:composition>
</html>